package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        Boo b=new Boo();
        //Boo b2=new Boo();
        Thread t1=new Thread("go"){
            public void run(){
                Boo.dosome();

            }
        };
        Thread t2=new Thread("bg"){
            public void run(){
                Boo.dosome();

            }
        };
        t1.start();
        t2.start();

    }
}
class Boo{
    public static void dosome(){
        synchronized (Boo.class){
            try {
                Thread t=Thread.currentThread();
                System.out.println(t.getName()+"正在执行dosmoe方法。。。");
                Thread.sleep(5000);
                System.out.println(t.getName()+"执行完毕");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }


    }
}
